package com.ying.rabbitmqspringbootconsumer.listener;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * ClassName: LimitListener
 * Package: com.ying.rabbitmqspringbootconsumer.listener
 * Description:
 *
 * @Author 刘英杰
 * @Create 2025/7/25 22:58
 * @Version 1.0
 */

@Component
public class LimitListener {

    @RabbitListener(queues = "limitQueue")
    public void limitListener(Message message, Channel channel) throws IOException {
        System.out.println(new String(message.getBody()));
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),true);
    }
}
